<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>物流装车</title>
    <link href="../../css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="../../font-awesome/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="../../css/animate.css" rel="stylesheet">
    <link href="../../css/style.css?v=2.2.0" rel="stylesheet">

</head>
<body class="top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <nav class="navbar navbar-static-top" role="navigation">
                <div class="navbar-header">
                    <button aria-controls="navbar" aria-expanded="false" data-target="#navbar" data-toggle="collapse" class="navbar-toggle collapsed" type="button">
                        <i class="fa fa-reorder"></i>
                    </button>
                    <a href="Logistics_navigation.html" class="navbar-brand">PIE</a>
                </div>
                <div class="navbar-collapse collapse" id="navbar">
                    <ul class="nav navbar-nav">
                        <li class="active">
                            <a aria-expanded="false" role="button" href="Logistics_navigation.html"> 返回主页</a>
                        </li>
                    </ul>
                    <ul class="nav navbar-top-links navbar-right">
                        <li id="logout">
                            <a href="">
                                <i class="fa fa-sign-out"></i> 退出
                            </a>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>


        <div class="middle-box text-center loginscreen   animated fadeInDown">
            <div>
                <div class="ibox-content">
                    <div>
                        <h3 class="">物流装车</h3>
                    </div>
                    <form class="m-t" role="form"  id="form">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入13位小猪ID" required="" id="Id" name="id">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入物流公司ID" required="" id="Lid" name="lid">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入车牌号（如：京P1234A）" required="" id="Cid" name="cid">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入18位司机ID" required="" id="Did" name="did">
                        </div>
                        <button type="button" class="btn btn-primary block full-width m-b" id="btnlr">提交</button>
                    </form>
                </div>
            </div>
        </div>



        <div class="footer">
            <div class="pull-right">
                PIE
            </div>
            <div>
                <strong>Copyright</strong> H+ &copy; 2014
            </div>
        </div>

    </div>
</div>

    <!-- Mainly scripts -->
    <script src="../../js/jquery-3.3.1.js"></script>
    <script src="../../js/bootstrap.min.js?v=3.4.0"></script>

    <script>
        $(function(){
            $(document).ready(function(){
                $("#btnlr").click(function(){
                    var lr = {
                        id: $("#Id").val(),
                        logisticsid: $("#Lid").val(),
                        carid: $("#Cid").val(),
                        driverid: $("#Did").val()


                    }
                    var LR=JSON.stringify(lr);
                    //alert(LR);
                    $.post({
                        url: "http://localhost:8080/logisticsreception",
                        headers: {
                            "Content-Type": "application/json; charset=utf-8"
                        }
                    }, LR,function (data){
                        if(data=="请先登录")
                        {
                            alert(data);
                            location.assign("http://localhost:8080/PorkTraceability/login/Login.html");
                        }
                        else {
                            alert(data);
                            location.reload();
                        }
                    })
                });
            });
        });

    </script>



    <script src="../../js/plugins/validate/jquery.validate.min.js"></script>
    <script src="../../js/plugins/validate/messages_zh.min.js"></script>

    <script>
            $(document).ready(function () {
                $("#form").validate({
                    rules:{
                        id:{
                            required:true,
                            number:true,
                            maxlength:13,
                            minlength:13
                        },
                        lid:{
                            required:true,
                            number:true,
                            maxlength:6,
                            minlength:6
                        },
                        cid:{
                            required:true,
                            maxlength:7,
                            minlength:7
                        },
                        did:{
                            required:true,
                            number:true,
                            maxlength:18,
                            minlength:18
                        }
                    }
                })
            })
    </script>
<script>
    $("#logout").click(function(){
        $.get("http://localhost:8080/logout",function () {
            location.assign("http://localhost:8080/PorkTraceability/login/Login.html");
        })
    })
</script>

</body>
</html>